/**
 * 
 */
package hihocoder;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class WordConstruction {

	static int max = 0;

	/**
	 * 由于用“不可有相同字符”这个条件能够去除很多字符串，所以暴力可以解决
	 * 
	 * @param isVisted
	 * @param strings
	 * @param i
	 * @param count
	 */
	public static void getRes(boolean[] isVisted, String[] strings, int i, int count) {
		max = Math.max(count, max);
		for (int j = 0; j < strings.length; j++) {
			String string = strings[j];
			boolean canVisit = true;
			for (int k = 0; k < string.length(); k++) {
				if (isVisted[string.charAt(k) - 'a']) {
					canVisit = false;
					break;
				}
			}
			if (canVisit) {
				for (int k = 0; k < string.length(); k++) {
					isVisted[string.charAt(k) - 'a'] = true;
				}
				getRes(isVisted, strings, i, count + 1);
				for (int k = 0; k < string.length(); k++) {
					isVisted[string.charAt(k) - 'a'] = false;
				}
			}
		}

	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		scanner.nextLine();
		String[] strings = scanner.nextLine().split(" ");
		boolean isVisted[] = new boolean[26];
		getRes(isVisted, strings, 0, 0);
		System.out.println(max);
	}
}
